package emulator.shell.GUI.profiling;

import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

public class CallTableData implements Comparable<CallTableData>
{
	private int enterAddress;
	private String label;
	private int hitCount;
	private long sumTotalTicks;
	private long sumTicks;
	private List<Integer> exitAddresses;
	private List<CallTableData> children = new LinkedList<CallTableData>();
	private Set<CallTableData> parents = new LinkedHashSet<CallTableData>();
	
	public int getEnterAddress() {
		return enterAddress;
	}
	public void setEnterAddress(int enterAddress) {
		this.enterAddress = enterAddress;
	}
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public int getHitCount() {
		return hitCount;
	}
	public void setHitCount(int hitCount) {
		this.hitCount = hitCount;
	}
	public long getSumTotalTicks() {
		return sumTotalTicks;
	}
	public void setSumTotalTicks(long sumTotalTicks) {
		this.sumTotalTicks = sumTotalTicks;
	}
	public long getSumTicks() {
		return sumTicks;
	}
	public void setSumTicks(long sumTicks) {
		this.sumTicks = sumTicks;
	}
	public List<Integer> getExitAddresses() {
		return exitAddresses;
	}
	public void setExitAddresses(List<Integer> exitAddresses) {
		this.exitAddresses = exitAddresses;
	}
	public List<CallTableData> getChildren() {
		return children;
	}
	public Set<CallTableData> getParents() {
		return parents;
	}
	
	@Override
	public int compareTo(CallTableData o)
	{
		long diff = o.getSumTotalTicks() - getSumTotalTicks();
		return diff != 0 ? (int)(diff/Math.abs(diff)) : 0;
	}
}
